<template>
  <div class="flex space-x-6">
    <div
      v-for="option in options"
      :key="option.value"
      class="tab-item"
      :class="{
        active: value === option.value,
      }"
      @click="toggle(option)"
    >
      {{ option.label }}
    </div>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: [String, Number],
      default: '',
    },
    options: {
      type: Array,
      default: () => [],
    },
  },
  methods: {
    toggle(item) {
      this.$emit('input', item.value)
      this.$emit('change', item)
    },
  },
}
</script>

<style lang="scss" scoped>
.tab-item {
  @apply text-sm text-index-desc cursor-pointer;
  &.active {
    @apply text-index-tab;
  }
}
</style>
